package com.usefullc.system.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.usefullc.system.domain.AppDevice;
import com.usefullc.system.domain.DataConfig;
import com.usefullc.system.mapper.DataConfigMapper;
import com.usefullc.system.query.BaseQuery;
import com.usefullc.system.query.DataConfigQuery;
import org.springframework.stereotype.Service;

/**
 * @author: Sampson
 * @date: 2022-01-09 09:58
 */
@Service
public class DataConfigService extends AbstractBizService<DataConfigMapper,DataConfig,DataConfigQuery> {


    public DataConfig findByCode(String code){
        DataConfigQuery dataConfigQuery = new DataConfigQuery();
        dataConfigQuery.setEnable(true);
        dataConfigQuery.setCode(code);
        return this.findOne(dataConfigQuery);

    }

    public int updateValueByCode(String code,String value){
        return this.getBaseMapper().updateValueByCode(code,value);
    }


    @Override
    public QueryWrapper<DataConfig> getQueryWrapper(DataConfigQuery query) {
        QueryWrapper<DataConfig> queryWrapper = super.getQueryWrapper(query);
        return queryWrapper;
    }
}
